<?php
/*
 * 主要功能:
 *
 * dreamxyp(QQ:31996798) - PHP - class.grade.php
 * coding:夏一平
 * 創建時間:2006-11-16
 */
 class grade
 {
	 
	static public $config = array(
		'add_review' => 1,
		'del_review' => 1,
		'add_flv_u'	 => 5,
		'del_flv_u'	 => 50,
		'add_flv_l'	 => 3,
		'del_flv_l'	 => 50,
		'add_flv_p'	 => 3,
		'del_flv_p'	 => 50,
		'indexgood'	 => 45
	);
	/*
 	 * 功能:取得$urs的積分
 	 */ 
 	 static public function get($urs)
 	 {
 	 	$mode 	= 'read';
 	 	$value 	= '0';
 	 	$reason = '';
		return self::conn($urs,$value,$mode,$reason);
 	 }
 	 static public function read($urs)
 	 {
 	 	return self::get($urs);
 	 }
 	/*
 	 * 功能:給$urs積分加$value的積分
 	 */
 	 static public function add($urs,$value,$reason='')
 	 {
 	 	$mode = 'add';
		return self::conn($urs,$value,$mode,$reason);
	 }
 	/*
 	 * 功能:給$urs積分減去$value的積分
 	 */ 
 	 static public function cut($urs,$value,$reason='')
 	 {
 	 	$mode 	= 'cut';
 	 	return self::conn($urs,$value,$mode,$reason);
 	 }
 	/*
 	 * 功能:清空$urs的積分
 	 */ 
 	 static public function clear($urs,$reason='')
 	 {
 	 	$mode 	= 'delfile';
 	 	$value 	= '0';
 	 	return self::conn($urs,$value,$mode,$reason);
 	 }
 	 /*
		@ 功能:積分
		@ 參數:$urs 	用戶id  不加@dreamxyp(QQ:31996798)
			   $value 	值
			   $mode 		操作，有  add 增加, cut 減少, delfile 清零, read 讀取 默認:add
	*/
 	 protected function conn($urs,$value,$mode,$reason='')
 	 {
 	 	$urs = explode('@',$urs);
		$value	 =+ $value;
		return file_get_contents('http://jifen.dreamxyp(QQ:31996798)/jifen/?user='.$urs[0].'&reason='.$reason.'&op='.$mode.'&score='.$value);
 	 }
 }
?>
